package tiantao.taogu.order.service;

import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import tiantao.taogu.order.bean.ChannelInfo;
import tiantao.tianjian.order.TgOrderInfo;

/**
 * 订单服务
 */
public interface OrderService {

  /**
   * 下单接口，下单前调用获取渠道列表接口让用户选择支付渠道
   * @param businessOrderId businessOrderId 业务订单ID
   * @param businessType 业务订单类型 体检套餐业务固定传22
   * @param price 订单价格 单位 分
   * @param userGuid 请求用户guid
   * @param channelId 支付渠道id 参见ChannelInfo.channelId
   * @param hospitalGuid  医院id
   * @param clientIp 用户端ip
   * @return
   */
  @RequestMapping("/taogu/order/createOrder")
  public Map<String, Object> createOrder(@RequestParam("businessOrderId") String businessOrderId, @RequestParam("businessType") String businessType,
      @RequestParam("price") int price, @RequestParam("userGuid") String userGuid, @RequestParam("channelId") int channelId,
      @RequestParam("hospitalGuid")String hospitalGuid,@RequestParam("clientIp")String clientIp);

  /**
   * 获取支付渠道
   * @param businessType 业务订单类型 体检套餐业务固定传22
   * @param clientType APP端：app 公众号：wechat
   * @param hospitalGuid
   * @return
   */
  @RequestMapping("/taogu/order/getChannel")
  public List<ChannelInfo> getChannel(@RequestParam("businessType") String businessType, @RequestParam("clientType") String clientType,
      @RequestParam("hospitalGuid")String hospitalGuid);
  
  /**
   * 主动查询获取支付结果
   * @param orderId 支付订单号
   * @param hospitalGuid
   * @return  返回空则未支付成功  否则返回成功数据
   */
  @RequestMapping("/taogu/order/getPayResult")
  public TgOrderInfo getPayResult(@RequestParam("orderId") String orderId,
      @RequestParam("hospitalGuid")String hospitalGuid);

  /**
   * 订单退费
   * @param businessOrderId 业务订单ID
   * @param businessType 业务订单类型
   * @param orderId 支付订单ID
   * @param transactionNo 支付流水号
   * @param refundCost 退费金额
   * @param refundReason 退费原因
   * @return
   */
  @RequestMapping("/taogu/order/orderRefund")
  public Integer orderRefund(@RequestParam("businessOrderId") String businessOrderId, @RequestParam("businessType") String businessType,
      @RequestParam("orderId") String orderId, @RequestParam("transactionNo") String transactionNo, @RequestParam("refundCost") String refundCost,
      @RequestParam("refundReason") String refundReason);
}
